<?php

namespace app\admin\controller;
use app\admin\controller\Main;
use think\Controller;
use think\Db;

class Recharge extends Main {

    public function index() {

        $_GPC = input();
        $page = max(intval($_GPC['page']), 1);
        $limit = max(intval($_GPC['limit']), 1);

        $row = Db::name('recharge_log')
                ->alias('r')
                ->join('member m', 'r.member_id=m.id')
                ->field('r.*, m.nickname,m.avatar,m.mobile')
                ->where('r.status', 1);
        if (!empty($_GPC['member_id'])) {
            $row = $row->where('member_id', $_GPC['member_id']);
        }
        $count = $row->count();
        $data = $row->page($page, $limit)->order('createtime', 'DESC')->select();
        jsonp($data, $count);
    }

}
